﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using RastinArgham.CRM.Business;

namespace RastinArgham.CRM.Web
{
    public partial class redirects : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            CRMRepository repo = new CRMRepository();

            if (Request.QueryString["Services_OrderId"] != null)
            {
                Order o = repo.GetOrderById(Convert.ToInt32(Request.QueryString["Services_OrderId"]));

                if (o != null)
                    Response.Redirect(o.Contact.ServicesLink);
            }

            if (Request.QueryString["Products_OrderId"] != null)
            {
                Order o = repo.GetOrderById(Convert.ToInt32(Request.QueryString["Products_OrderId"]));

                if (o != null)
                    Response.Redirect(o.Contact.ProductsLink);
            }
        }
    }
}